#ifndef __IMAGE_DATA_COLLECT_H__
#define __IMAGE_DATA_COLLECT_H__

#include <ros/ros.h>
#include <image_transport/image_transport.h>
#include <cv_bridge/cv_bridge.h>
#include <tf/tf.h>
#include <tf/transform_listener.h>
#include <sensor_msgs/CameraInfo.h>
#include <sensor_msgs/Image.h>
#include <opencv2/opencv.hpp>
#include "comm/comm_base.h"
#include "data_file.h"

using namespace std;

class IMAGE_MSG_RECEIVER_C
{
public:

    IMAGE_MSG_RECEIVER_C(ros::NodeHandle &nh, string sensorName) {
        receiver_ = nh.subscribe(sensorName, 1, &IMAGE_MSG_RECEIVER_C::MsgReceiveCallBack, this);
    }

    ~IMAGE_MSG_RECEIVER_C(){}

    void MsgReceiveCallBack(const sensor_msgs::Image::ConstPtr& imageMsg);
    void GetNormalImage(cv::Mat& image);

private:
    ros::Subscriber     receiver_;
    cv::Mat             image_;
    DATA_FILE_C         objDataFile_;
    
};


class IMAGE_DATA_COLLECT_C
{
public:
    
    IMAGE_DATA_COLLECT_C(ros::NodeHandle &nh, string cameraName)
      : objImageMsgRec_(nh, cameraName)
    {
        cameraName_ = cameraName;
    }
    
    ~IMAGE_DATA_COLLECT_C(){}

    int  Init();
    void DataCollect();

private:
    string GetPrefix(const string &cameraName);

    IMAGE_MSG_RECEIVER_C    objImageMsgRec_;
    DATA_FILE_C             objDataFile_;
    std::string             strPrefix_;
    std::string             cameraName_;

};

#endif


